class Solution:
    def plusOne(self, digits):
        self.digits = digits
        try:
            self.add(-1)
        except:
            self.digits.insert(0, 1)
        return self.digits

    def add(self, index):
        self.digits[index] += 1
        if self.digits[index] == 10:
            self.digits[index] = 0
            self.add(index-1)



a = Solution()
print(a.plusOne([9, 9]))